﻿package game.account.preview {
	import game.alternativa.ModelViewer.IModelParams;
	import game.objects.TextureObject;
	import alternativa.engine3d.resources.BitmapCubeTextureResource;
	import flash.display.BitmapData;
	import flash.display3D.textures.CubeTexture;
	
	public class PreviewObject implements IModelParams {
		
		
		public static const WHEEL4:String			= "wheel4";
		public static const WHEEL3:String			= "wheel3";
		public static const WHEEL2:String			= "wheel2";
		public static const WHEEL1:String			= "wheel1";
		public static const WHEEL:String			= "wheel";
		public static const BUMPER_FONT:String		= "bumper_font";
		public static const BUMPER_BACK:String		= "bumper_back";
		public static const HOOD:String				= "hood";
		public static const THRESHOLD:String		= "threshold";
		public static const BODY:String				= "body";
		public static const WINDOW:String			= "window";
		public static const LIGHTS:String			= "lights";
		public static const LIGHTS_WINDOW:String	= "lights_window";
		public static const SPOILER:String			= "spoiler";
		public static const GARAGE_BOTTOM:String	= "garage_bottom";
		public static const GARAGE_TOP:String		= "garage_top";
		public static const GARAGE_WALLS:String		= "garage_walls";
		public static const GARAGE_SPEC:String		= "garage_spec";
		
		public function get isDebugger():Boolean { return false; }
		
		public function get zoom():Number { return 2.3; }
		
		public function get cameraZMin():Number { return 40;	}
		public function get cameraZMax():Number { return 300;	}
		
		public function get reflect():uint { return 0x111111; }
		public function get cubeGarage():BitmapCubeTextureResource {
			return new BitmapCubeTextureResource(	new cube2,
													new cube4,
													new cube6,
													new cube3,
													new cube5,
													new cube1 );
		}
		
		public function get models():Array {
			return [
					{
						name: WHEEL4,
						a3d: null,
						textures: null,
						shadow: null
					},
					{
						name: WHEEL3,
						a3d: null,
						textures: null,
						shadow: null
					},
					{
						name: WHEEL2,
						a3d: null,
						textures: null,
						shadow: null
					},
					{
						name: WHEEL1,
						a3d: null,
						textures: null,
						shadow: null
					},
					{
						name: BUMPER_FONT,
						a3d: null,
						textures: null,
						shadow: null
					},
					{
						name: BUMPER_BACK,
						a3d: null,
						textures: null,
						shadow: null
					},
					{
						name: HOOD,
						a3d: null,
						textures: null,
						shadow: null
					},
					{
						name: THRESHOLD,
						a3d: null,
						textures: null,
						shadow: null
					},
					{
						name: LIGHTS,
						a3d: null,
						textures: null,
						shadow: null
					},
					{
						name: LIGHTS_WINDOW,
						a3d: null,
						textures: null,
						shadow: null
					},
					{
						name: BODY,
						a3d: null,
						textures: null,
						shadow: null
					},
					{
						name: WINDOW,
						a3d: null,
						textures: null,
						shadow: null
					},
					{
						name: SPOILER,
						a3d: null,
						textures: null,
						shadow: null
					},
					{
						name: GARAGE_BOTTOM,
						a3d: 'garazh_pol.a3d',
						textures: new <TextureObject>[
							new TextureObject ( TextureObject.DIFFUSE,	'Pol_dif.jpg' ),
							new TextureObject ( TextureObject.BUMP,		'Pol_normal.jpg' ),
							new TextureObject ( TextureObject.SPECULAR,	'Pol_Spec.jpg' )
						]
					},
					{
						name: GARAGE_TOP,
						a3d: 'garazh_potolok.a3d',
						textures: new <TextureObject>[
							new TextureObject ( TextureObject.DIFFUSE,	'Potolok_dif.jpg' ),
							new TextureObject ( TextureObject.BUMP,		'Potolok_dif.jpg' ),
							new TextureObject ( TextureObject.SPECULAR,	'Potolok_dif.jpg' )
						]
					},
					{
						name: GARAGE_WALLS,
						a3d: 'garazh_steni.a3d',
						textures: new <TextureObject>[
							new TextureObject ( TextureObject.DIFFUSE,	'Steni_diff.jpg' ),
							new TextureObject ( TextureObject.BUMP,		'Steni_normal.jpg' ),
							new TextureObject ( TextureObject.SPECULAR,	'Steni_diff.jpg' )
						]
					},
					{
						name: GARAGE_SPEC,
						a3d: 'garazh_dop.a3d',
						textures: new <TextureObject>[
							new TextureObject ( TextureObject.DIFFUSE,	'Dopolnenia_diff.jpg' ),
							new TextureObject ( TextureObject.BUMP,		'Dopolnenia_normal.jpg' ),
							new TextureObject ( TextureObject.SPECULAR,	'Dopolnenia_Spec.jpg' )
						],
						shadow: true
					}
			];
		}
		
		public function get view():Object {
			return {
				renderToBitmap: true,
				backgroundColor: 0x383838,
				backgroundAlpha: 1,
				antiAlias: 16,
				rightClick3DEnabled: true
			}
		}
		
		public function get camera():Object {
			return {
				nearClipping: 10,
				farClipping: 1000,
				rotationX: -Math.PI / 2,
				y: -322
				
			}
		}
		
		public function get shadowLights():Array {
			return [
				/*{
					x: 0,
					y: 0,
					z: 150,
					color: 0xffffff
				}*/
			]
		}
		
		public function get lights():Array {
			return [
				{
					x: 150,
					y: 200,
					z: 150,
					color: 0xffffff,
					attenuationBegin: 100,
					attenuationEnd: 400
				},
				{
					x: -150,
					y: 200,
					z: 150,
					color: 0xffffff,
					attenuationBegin: 100,
					attenuationEnd: 400
				},
				{
					x: 150,
					y: -200,
					z: 150,
					color: 0xffffff,
					attenuationBegin: 100,
					attenuationEnd: 400
				},
				{
					x: -150,
					y: -200,
					z: 150,
					color: 0xffffff,
					attenuationBegin: 100,
					attenuationEnd: 400
				}
			]
		}
		
		public function get shadow():Object {
			return {
				width: 1000,
				height: 1000, 
				nearBoundPosition: -500,
				farBoundPosition: 500,
				mapSize: 1024,
				pcfOffset: 1
			}
		}
	}
}